TMCSocket Class Reference
[MCCore]

Inheritance diagram for TMCSocket:

TMCSMPCountedObject IMCSocket IMCUnknown IMCUnknown List of all members.

Public Member Functions

virtual MCErr MCCOMAPI QueryInterface (const MCIID &riid, void **ppvObj)
virtual uint32 MCCOMAPI AddRef ()
virtual uint32 MCCOMAPI Release ()
virtual void MCCOMAPI Init (EProtocol protocol, int32 portNumber)
virtual void MCCOMAPI SendBroadcast (uint32 broadcastAddress, const TMCString &message)
virtual void MCCOMAPI BindToPort ()
virtual boolean MCCOMAPI WaitForReadableData (float timeOutInSeconds)
virtual void MCCOMAPI ListenForConnections ()
virtual bool MCCOMAPI Accept (IMCSocket *outSocket, float timeOutInSeconds)
virtual bool MCCOMAPI Connect (const char *serverAddress, float timeOut)
virtual int32 MCCOMAPI GetData (char *buffer, int32 bufferSize)
virtual int32 MCCOMAPI PutData (const char *buffer, int32 bytesCount)
virtual boolean MCCOMAPI IsClosed ()
virtual void MCCOMAPI Close ()

Static Public Member Functions

static void Initialize ()
static void GetHostIPAddress (uint32 &ipAddress, uint32 subNetID, uint32 subNetMask)
static void IPtoString (uint32 address, TMCString &string)
static void StringtoIP (const TMCString &string, uint32 &address)
static void GetDefaultSubNet (uint32 &subNetID, uint32 &subNetMask)
static void GetHostName (TMCString &name)
static int32 CheckForRead (const TMCCountedPtrArray< IMCSocket > &socketArray, real timeOutInSeconds)
static void Create (IMCSocket **socket)

Protected Member Functions

 TMCSocket ()
 ~TMCSocket ()

Protected Attributes

int32 fPortNumber
uint32 fSocketID
EProtocol fProtocol

Static Protected Attributes

static boolean sInitialized

Classes

struct  IPAddress

Detailed Description

TMCSocket is a simple abstraction of the bsd sockets


Constructor & Destructor Documentation

TMCSocket::TMCSocket (   )  [protected]
 

TMCSocket::~TMCSocket (   )  [protected]
 


Member Function Documentation

virtual bool MCCOMAPI TMCSocket::Accept (  IMCSocket *  outSocket,
float  timeOutInSeconds
)  [virtual]
 

Waits for a connection on a socket. Returns a new socket if a connection is established

Parameters:
outSocket 
timeOutInSeconds 

Implements IMCSocket.

virtual uint32 MCCOMAPI TMCSocket::AddRef (   )  [inline, virtual]
 

Increments the reference count of the object

Reimplemented from TMCSMPCountedObject.

virtual void MCCOMAPI TMCSocket::BindToPort (   )  [virtual]
 

binds the socket to its port

Implements IMCSocket.

static int32 TMCSocket::CheckForRead (  const TMCCountedPtrArray< IMCSocket > &  socketArray,
real  timeOutInSeconds
)  [static]
 

virtual void MCCOMAPI TMCSocket::Close (   )  [virtual]
 

Closes the socket.

Implements IMCSocket.

virtual bool MCCOMAPI TMCSocket::Connect (  const char *  serverAddress,
float  timeOut
)  [virtual]
 

Implements IMCSocket.

static void TMCSocket::Create (  IMCSocket **  socket  )  [static]
 

virtual int32 MCCOMAPI TMCSocket::GetData (  char *  buffer,
int32  bufferSize
)  [virtual]
 

returns the number of characters read

Implements IMCSocket.

static void TMCSocket::GetDefaultSubNet (  uint32 &  subNetID,
uint32 &  subNetMask
)  [static]
 

Returns the default the subnet info (the first adapter found on the system)

Parameters:
subNetID The ID of the sub Net
subNetMask The mask of the sub Net

static void TMCSocket::GetHostIPAddress (  uint32 &  ipAddress,
uint32  subNetID,
uint32  subNetMask
)  [static]
 

Returns the IP address of the local machine on a given sub net. If no address matches the given subnet then the first ip address is returned.

Parameters:
ipAddress The IP Address
subNetID The ID of the sub Net
subNetMask The mask of the sub Net

static void TMCSocket::GetHostName (  TMCString &  name  )  [static]
 

Returns a string that contains the name of the local machine

Parameters:
name The name of the local machine

virtual void MCCOMAPI TMCSocket::Init (  EProtocol  protocol,
int32  portNumber
)  [virtual]
 

static void TMCSocket::Initialize (   )  [static]
 

should be called once before using any of the socket code

static void TMCSocket::IPtoString (  uint32  address,
TMCString &  string
)  [static]
 

Returns the string that corresponds to an IP address.

Parameters:
address The IP address
string The string

virtual boolean MCCOMAPI TMCSocket::IsClosed (   )  [virtual]
 

Implements IMCSocket.

virtual void MCCOMAPI TMCSocket::ListenForConnections (   )  [virtual]
 

Implements IMCSocket.

virtual int32 MCCOMAPI TMCSocket::PutData (  const char *  buffer,
int32  bytesCount
)  [virtual]
 

Implements IMCSocket.

virtual MCErr MCCOMAPI TMCSocket::QueryInterface (  const MCIID &  riid,
void **  ppvObj
)  [inline, virtual]
 

Check if the object supports a given interface and returns a pointer to that interface if it does. Note that QueryInterface will increment the reference count of the object by one if the interface is found.

Parameters:
riid GUID of the interface
ppvObj A pointer to the pointer being returned.

Reimplemented from TMCSMPCountedObject.

virtual uint32 MCCOMAPI TMCSocket::Release (   )  [inline, virtual]
 

Decrements the reference count of the object. If the reference count reaches zero, the object is destroyed.

Reimplemented from TMCSMPCountedObject.

virtual void MCCOMAPI TMCSocket::SendBroadcast (  uint32  broadcastAddress,
const TMCString &  message
)  [virtual]
 

broadcast udp message

Implements IMCSocket.

static void TMCSocket::StringtoIP (  const TMCString &  string,
uint32 &  address
)  [static]
 

Returns the IP address corresponding to a string

Parameters:
address The IP address
string The string

virtual boolean MCCOMAPI TMCSocket::WaitForReadableData (  float  timeOutInSeconds  )  [virtual]
 

wait for data to be available for reading, return false if times out

Implements IMCSocket.


Member Data Documentation

int32 TMCSocket::fPortNumber [protected]
 

EProtocol TMCSocket::fProtocol [protected]
 

uint32 TMCSocket::fSocketID [protected]
 

boolean TMCSocket::sInitialized [static, protected]
 


The documentation for this class was generated from the following file:
Generated on Wed Dec 7 14:27:49 2005 for Carrara SDK Doc by  doxygen 1.4.5